package com.test.test.timerTask.Timer;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimerTask;

import lombok.Data;

@Data
public class DanceRobot extends TimerTask {

	private boolean danceFlag = true;

	@Override
	public void run() {
		Calendar now = Calendar.getInstance();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
		while (danceFlag) {
			
			System.out.println("dance 线程当前时间：" + sdf.format(now.getTime()));
			System.out.println("dance happy!");
			try {
				Thread.sleep(2000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		now = Calendar.getInstance();
		System.out.println("dance 结束时间：" + sdf.format(now.getTime()));
	}

}
